<!--装修需求详情页面-->
<template>
	<view>
		<view class="bg"></view>
		<view class="ywjy">
			<u-row gutter="16" class="ele">
				<u-col span="12">
					<view class="name">装修详情</view>
				</u-col>
			</u-row>
			<u-gap style="margin-top:20upx;" height="2" bg-color="#eaeaea"></u-gap>
			<u-row gutter="16" class="ele">
				<view class="child textcontent">
					<view style="width: 50upx; display: inline-block">
					<u-icon name="map" color="#2979ff" size="40"></u-icon>
					</view>
					{{ address }}
				</view>
				
				<u-col span="12" class="item">
					<view class="child">
						<view style="width: 50upx;display: inline-block">
						<u-icon name="list-dot" color="#2979ff" size="40"></u-icon>
						</view>
						{{shi || 0}}室 - {{ting || 0}}厅 - {{chu || 0}}厨 - {{wei || 0}}卫
					</view>
				</u-col>
				
				<u-col span="12" class="item">
					<view class="child">
						<view style="width: 50upx; display: inline-block">
						<u-icon name="clock" color="#2979ff" size="40"></u-icon>
						</view>
						{{ orderTime }}
					</view>
				</u-col>
			</u-row>
		</view>
		<!--1：已处理  0：未处理-->
		<view class="addSite" v-if="status == 0" >
			<view  class="telphone" @click="go()">
				<u-icon name="phone" color="#2979ff" size="40"></u-icon>
				&nbsp;拨打电话
			</view>
		</view>
		<view style="height: 80px;"></view>
		<u-top-tips ref="uTips" style="top:0"></u-top-tips>
	</view>
</template>

<script>
export default {
	data() {
		return {
			id:'',
			connectTel: '',
			status: '',
			orderTime: '',
			address: '',
			shi:'',
			ting:'',
			chu:'',
			wei:''
			 
		
		 
		};
	},
	methods: {
		loadData(serviceId) {
			this.$u.get('/front/zhuangxiu/zxinfo/' + serviceId).then(res => {
				if (res.code == 200) {
					 this.status = res.data.status;
					 this.address = res.data.province + "-" + res.data.city + "-" + res.data.country;
					 this.orderTime = res.data.submitTime;
					 this.connectTel = res.data.mobile;
				} else {
					this.$refs.uTips.show({
						title: res.msg,
						type: 'warning',
						duration: '2300'
					});
				}
			});
		},
		takeOrder(){
			this.$u.get('/front/zhuangxiu/takeZxOrder/' + this.id).then(res => {
				if (res.code == 200) {
					 this.status = 1;
				} else {
					this.$refs.uTips.show({
						title: res.msg,
						type: 'warning',
						duration: '2300'
					});
				}
			});
		},
		go() {
			uni.makePhoneCall({
				// 手机号
				phoneNumber: this.connectTel,
				// 成功回调
				success: res => {
					console.log('调用成功!');
				},
				// 失败回调
				fail: res => {
					console.log('调用失败!');
				}
			});
		}
	},
	onLoad(...options) {
		const id = this.$Router.$route.history.current.params.id;
		this.id = id;
		this.loadData(id);
	}
};
</script>

<style lang="scss" scoped>
.bg {
	position: fixed;
	top: 0;
	width: 100%;
	height: 900upx;
	background-image: linear-gradient(#fa8513, #fff);
}
.ywjy {
	font-size: 1.1em;
	padding: 10upx;
	position: relative;
	margin: 0 auto;
	margin-top: 20upx;
	z-index: 1;
	width: 95%;
	height: 100%;
	border-radius: 5px;
	background-color: #ffff;
	.textcontent{
		word-wrap: break-word; 
		word-break: break-all; 
		overflow: hidden;
	}
	.ele {
		margin-top: 15upx;
	}
	.name {
		font-weight: bold;
		font-size: 1.5em;
	}
	.item {
		margin-top: 10upx;
		.child {
			height: 50upx;
			line-height: 50upx;
		}
	}
}
.addSite {
	border-top: 1px solid #ebebeb;
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1030;
	line-height: 100rpx;
	font-size: 30rpx;
	display: flex;
	.telphone {
		flex-grow: 2;
		text-align: center;
		background-color: #ffff;
	}
	.telphone-gray {
		flex-grow: 2;
		text-align: center;
		background-color: #cfd0c6;
	}
	.add {
		background-color: #fa8513;
		color: #ffffff;
		width: 300upx;
		text-align: center;
	}
	.add-gray {
		background-color: #cfd0c6;
		color: #ffffff;
		width: 300upx;
		text-align: center;
	}
}
</style>
